A step by step LED lamp DIY guide for smart home
Created: 2017-09-23 Sat 22:17
Self Intro
- make a living as digital IC design engineer
- long-time GNU/Linux user
- maintainer(one of) of SHLUG
WHY?
Why DIY if you can buy?
what's wrong?
not BRIGHT enough
~1000ml ≈ 75W incandescent light bulb
requirement
- bright, very bright
- wireless control(on/off, brightness)
- color temperature tunable
- light reflect from ceiling, so product soft light
HOW?
- hardware
- firmware
- software(optional)
Hardware
- controller
- light source
- misc
- tools
wireless control
- wifi
- bluetooth
- RF/zigbee/…
pros
- cheap
- resource, or document
- community
- with mostly free(as freedom) SDK & develop tools
cons
- difficult to develop program
- alien arch: xtensa lx106
- lwIP network stack
- limited hardware resource
- 80MHz/160MHz CPU
- 160KiB RAM
color temperature control
- use both white & yellow LED source
light source
- high power LED, white & yellow(warm white)
- driver LED directly, accept AC, with PWM control
driver
NOTE: driver & LED should match
misc
other necessary parts
passive cooling, be quiet
photos
(view with geeqie)
C program
- no dynamic mem alloc
- connect to wifi router when startup
- accept tcp connection
- translate command to dual channel pwm output and response to command
integration
Home Assistant
mqtt
A lightweight message queue bridge HA & custom devices
command converter
- connect to LED
- periodicly query state to avoid timeout
- connect to mqtt
- convert mqtt message to tcp command
- convert tcp response to mqtt message